Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup db.models.fields.Field overloads for pyright 1.1.378 #265

Merged
merged 6 commits into from
Sep 2, 2024

Conversation

minmax
Copy link

@minmax minmax commented Aug 29, 2024

Fix for #264

@minmax minmax force-pushed the fixes-for-pyright-1.1.378 branch from 64371fe to 15ef8d9 Compare August 29, 2024 23:48
@minmax
Copy link
Author

minmax commented Aug 30, 2024

Hi @sbdchd, should I remove Unused "type: ignore" comment from typings directory as mypy wants?

name: str | None = ...,
primary_key: bool = ...,
max_length: int | None = ...,
unique: bool = ...,
blank: bool = ...,
null: Literal[False] = ...,
null: Literal[False] = False,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we still want these to be ..., I think in general type stubs don't specify the actual default value

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i understood it correctly, then we can't do ... more. We definitely need a default value, for the correct choice of @overload. microsoft/pyright#8860 was closed as "as designed", so i think stubs should accept this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed a bug that results in a false negative when overloads overlap due to default values.

pyright 1.1.378 changelog

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we still want these to be ..., I think in general type stubs don't specify the actual default value

@sbdchd
How strong is your commitment to ...? Did the new rules in pyright introduce a bit of doubt?

The dev version of pylance already includes the new pyright, in a month it will appear for all users.

After which nullable fields will "break" in their projects, let's fix them in advance.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah seems like things have changed to allowing default values in stubs:
python/typeshed#8988 (comment)

keeping them in should be all good!

Copy link
Owner

@sbdchd sbdchd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

@kodiakhq kodiakhq bot merged commit 7f9bd0d into sbdchd:main Sep 2, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants